package net.butfly.bus;

import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.METHOD)
public @interface TX {
	static String DEFAULT_VERSION = "0";

	public String value();

	public String version() default DEFAULT_VERSION;

	public enum Internal {
		PING("BUS_00_00"), STAT("BUS_01_01");
		private String tx;

		public String getTx() {
			return tx;
		}

		Internal(String tx) {
			this.tx = tx;
		}

		public static Internal parse(String tx) {
			for (Internal v : Internal.values())
				if (v.getTx().equals(tx)) return v;
			throw new IllegalArgumentException();
		}
	}
}
